package com.atguigui.leetcode;

/**
 * 1812.判断国际象棋棋盘中一个格子的颜色
 * Project: leetcode
 * Package: com.atguigui.leetcode
 * Version: 1.0
 * <p>
 * Created by WJX on 2022/12/8 8:40
 */
public class P1812DetermineColorOfAChessboardSquare {

    public static void main(String[] args) {
        Solution solution = new P1812DetermineColorOfAChessboardSquare().new Solution();
        // TO TEST
    }


    class Solution {
        public boolean squareIsWhite(String coordinates) {
            int a = coordinates.charAt(0) - 96;
            Integer b = Integer.valueOf(String.valueOf(coordinates.charAt(1)));
            //行数和列数（均从 111 开始计数）之和如果为奇数，则为白色格子，如果和为偶数，则为黑色格子
            return (a + b) % 2 == 0;
        }
    }
}
